package com.cheer.ba.choosepic.ui;


import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.GridView;
import android.widget.TextView;

import com.cheer.ba.R;
import com.cheer.ba.choosepic.adp.FolderAdapter;
import com.cheer.ba.choosepic.util.Bimp;
import com.cheer.ba.choosepic.util.Res;
import com.cheer.ba.constant.IntentKey;
import com.cheer.ba.event.BaseEvent;
import com.cheer.ba.view.base.BaseCommAty;

import org.greenrobot.eventbus.EventBus;

import butterknife.BindView;
import butterknife.OnClick;

/**
 * 这个类主要是用来进行显示包含图片的文件夹
 *
 * @author king
 * @version 2014年10月18日  下午11:48:06
 * @QQ:595163260
 */
public class ImageFileAty extends BaseCommAty {

    @BindView(R.id.fileGridView)
    GridView mGridView;
    private FolderAdapter folderAdapter;

    @Override
    protected boolean isTitleBarShow() {
        return false;
    }

    @Override
    public View loadView(LayoutInflater inflater, View childView) {
        return super.loadView(inflater, inflater.inflate(R.layout.aty_img_file, null, false));
    }

    @Override
    public void initView() {
        folderAdapter = new FolderAdapter(this);
        mGridView.setAdapter(folderAdapter);

        folderAdapter.setOnItemClickListener(new FolderAdapter.OnItemClickListener() {
            @Override
            public void onItemClick(int position) {
                BaseEvent event1 = new BaseEvent();
                event1.type = IntentKey.General.KEY_REFRESH_DATA;
                event1.pos = position;
                EventBus.getDefault().post(event1);
                finish();
            }
        });
    }

    @OnClick({R.id.id_pic_back_txt})
    public void onClick(View mView) {
        switch (mView.getId()) {
            case R.id.id_pic_back_txt:
                finish();
                break;
        }
    }

}
